This invention relates to an image processing apparatus, an image processing method, and a program that performs image processing on an image having a wide dynamic range and including image data with a negative (minus) value.
Scene-referred image representations having exact color information of photographed objects and sights are used for the purpose of reproducing colors exactly and are used as a reference of a photographed image in color management. For example, in the Academy of Motion Picture Arts and Sciences (AMPAS), a scene-referred wide dynamic range image color space (ACES) is defined in color management for movie production and is used as a reference for matching colors of images photographed by various cameras. The ACES is disclosed in Specification S-2008-001, Academy Color Encoding Specification (ACES), The Academy of Motion Picture Arts and Sciences, Science and Technology Council, Image Interchange Framework Subcommittee, Version 1.0, Aug. 12, 2008 (Non-Patent Document 1).
The color space of ACES has a very wide dynamic range as described above, and image data of pixels is expressed as a floating point number. At the time of image processing such as gradation conversion or image conversion, it is necessary to deal with image data having the wide dynamic range as an input.
Methods of performing gradation conversion of an image include, for example, a method of using a computing equation, a method of using a lookup table (LUT), and the like. In the method of using a computing equation, a calculation formula becomes complex, and thus it is difficult to express arbitrary gradation characteristics.
In contrast, although an LUT is discrete, an arbitrary value can be set by the LUT. Thus, the LUT can express arbitrary characteristics and is generally and widely used. The LOT is a table in which output values corresponding to specific discrete input values are described. The LUT is classified into two types of a type A and a type B shown in the following Table 1 and Table 2, respectively. FIG. 8 is a graph showing the relationship between input values and output values of an LUT corresponding to Table 1 and Table 2.
TABLE 1Input ValueOutput Value−0.0010.031622777002.551.59687194298.49.91967741435918.94729532458067.6756972611596107.68472565535255.9980469
TABLE 2Input ValueOutput Value−0.0010.031622777000.0010.0316227770.0020.044721360.0030.054772256. . .. . .6553.999255.998044965535255.9980469
In the LUT of the type A, as shown in Table 1, intervals between input values (set input values) which are set in the LUT are arbitrary, and an output value for an arbitrary input value is obtained by interpolation computation from two set input values with the arbitrary input value interposed therebetween (before and after the arbitrary input value).
In the LUT of the type B, as shown in Table 2, intervals between input values are equal intervals, and an output value for an arbitrary input value may be obtained by interpolation computation from two set input values with the arbitrary input value interposed therebetween in a similar manner to the type A, or an arbitrary input value may be rounded off between intervals of input values (for example, the arbitrary input value is rounded off) and an output value of a conforming set input value may be used. The LUT of the type B is generally and widely used because data reference of output value can be performed by address calculation from the input value and is very simple in either case.
In the LUT of the type B, as is understood from Table 2 described above, the number of pieces of data enormously increases in order to deal with data having a wide range. When an image having a wide dynamic range is used as a target, outdoor sunlight is equal to or greater than 10000 cd/ma, moonlight is approximately 0.01 cd/m2, and a dynamic range is 6 (=Log10(10000/0.01)). In general, since inputs of an LOT have values of steps at equal intervals, 106=1000000 input values are required to cover the above dynamic range, and furthermore, there is a problem of a resolution being roughened in a dark region.
Since a human's perception of brightness has a relationship of a Log function (Weber-Fechner's Law), a method of implementing an LUT after performing Log transformation of image data having linear brightness is used. For example, an LUT having a dynamic range of 6 at intervals of Log10=0.01 has 600 input values. In this case, since a very small number of input values of the LOT are required as compared with a case of the above-described antilogarithm, it is possible to increase resolution by increasing the number of input values to a certain degree, and thus it is possible to cover up to high brightness region while securing a resolution of a dark region.
However, the Log transformation becomes infinite in a case where an input has a value of 0 and becomes incomputable in a case where an input has a negative value, and thus image data having a negative value cannot be dealt with. In general, since image data nearly has had a positive value equal to or greater than 0 so far, there was no problem. However, in a case of scene-referred image data, it is necessary to transform image data photographed by a camera into a scene-referred color, and a negative value may be generated as a result of the computation. Although a method of simply clipping the negative value before the Log transformation is considered, an image may become unnatural and furthermore, information may be missed.
Here, JP 2004-221644 A (Patent Document 1) and JP 2003-283927 A (Patent Document 2) are the prior art relating to the present invention.
Patent Document 1 discloses an image processing apparatus that performs logarithmic transformation of brightness of an image having a wide dynamic range (DR), corrects the brightness of the image, having been subjected to the logarithmic transformation, on the basis of an LUT equivalent to a tone curve, and compresses a gradation of the image corrected using the LUT to a range of a gradation that can be displayed by a display, and then performs inverse logarithmic transformation of the brightness of the image of which the gradation is compressed to thereby output the brightness as brightness of the image of which the gradation is compressed.
Patent Document 2 discloses a method of emphasizing a contrast of a digital image by a non-linear transformation function q(x). In addition, Patent Document 2 discloses that the transformation function is expanded to q(x)=−q−x) in a negative region in order to deal with a negative value x<0. Further, Patent Document 2 discloses a combination of an exponential function term and a linear term as the transformation function q,x).
However, in Patent Document 1, it is not possible to deal with image data having a negative value. On the other hand, Patent Document 2 relates to contrast emphasis processing, and does not relate to gradation processing of an image having a wide dynamic range and also does not relate to logarithmic transformation of an image.